//
//  JRBaseViewController.swift
//  swiftWeiBo
//
//  Created by Johnray on 15/9/21.
//  Copyright © 2015年 Johnray. All rights reserved.
//

import UIKit

class JRBaseViewController: UITableViewController {
    
    private var UserLogin = false
    
    var visableView:JRVisiableView?
    
    override func loadView() {
        
        
        
        UserLogin ? super.loadView() : setView()
        
        
    }
    
    
    func setView(){
        visableView = JRVisiableView()
       
        
        
        view = visableView
    
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        
        //TODO: - 给visitble的按钮添加方法
        visableView?.loginBtn.addTarget(self, action: "loginClick", forControlEvents: UIControlEvents.TouchUpInside)
        
        visableView?.registerBtn.addTarget(self, action: "registerClick", forControlEvents: UIControlEvents.TouchUpInside)
        
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: "registerClick")
        
         navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: .Plain, target: self, action: "loginClick")
        
        
        
    }
    
    
    //MARK: - 访客界面按钮点击回调
    @objc private func loginClick(){
        
        let vc = JROAthViewController()
        
        presentViewController(UINavigationController(rootViewController: vc), animated: true, completion: nil)
        
    
    }
    
    @objc private func registerClick(){
        
        print("注册")
    
    
    }
    
    
    
    

}
